/*
 * Line.h
 *
 *  Created on: 2009-3-23
 *      Author: Songyp
 */

#ifndef LINE_H_
#define LINE_H_

#include <e32base.h>
#include "BasicGeometry.h"

class CBall;

class CLine : public CBase
	{
private:
	TRealPoint iStart;
	TRealPoint iEnd;
	// Ax+By+c = 0;
	TReal iA;
	TReal iB;
	TReal iC;
public:
	static CLine* NewL( TRealPoint aStart, TRealPoint aEnd );
	TPoint GetStart();
	void SetStart( TPoint aStart );
	TPoint GetEnd();
	void SetEnd( TPoint aEnd );
	TRealVector GetDir();
	TRealVector GetPerDic();
	TInt GetY( TInt aX );
	TBool IsVertical();
	TBool IsHorizonal();
	virtual TBool Hit( CBall* aBall );
	virtual TReal Distance( TPoint aPoint );
	virtual TPoint GetPerFoot( TPoint aPoint );
private:
	CLine( TRealPoint aPoint1, TRealPoint aPoint2 );
	void ConstructL();
	void Initialize();
	};

#endif /* LINE_H_ */
